package kr.co.medical.md5;

import java.security.MessageDigest;

public class Md5 {
	public String getEncMD5(String txt) throws Exception {
	    
	    StringBuffer sbuf = new StringBuffer();

	    MessageDigest mDigest = MessageDigest.getInstance("MD5");
	    mDigest.update(txt.getBytes());
	     
	    byte[] msgStr = mDigest.digest() ;
	     
	    for(int i=0; i < msgStr.length; i++){
	        String tmpEncTxt = Integer.toHexString((int)msgStr[i] & 0x00ff) ;           
	        sbuf.append(tmpEncTxt) ;
	        System.out.println("tmpEncTxt : " + tmpEncTxt);   
	    }

	    return sbuf.toString() ;
	}
}
